/**
 * 全局状态管理
 */
import { create } from 'zustand'
import { useRefreshBugList } from '@/apps/bug-manager/stores'

/**
 * 全局加载
 * loading: 全局加载
 * setLoading: 设置全局加载
 * resetLoading: 重置全局加载
 */
// const useGlobalLoading = create((set): TypeGlobalLoading => ({
//   loading: false,
//   setLoading: () => set({ loading: true }),
//   resetLoading: () => set({ loading: false }),
// }))

/**
 * 语言
 * language: 语言
 * l: 国际化
 * setLanguage: 设置语言
 * resetLanguage: 重置语言
 */
const useLanguage = create((set): LanguageStateType => ({
  language: 'zh-CN',
  setLanguage: (language?: LanguageValueType) => {
    set({ language: language || 'zh-CN' })
  },
  resetLanguage: () => set({ language: 'zh-CN' }),
}))

/**
 * 获取 B 站 WBI 验证
 */
const useWBI = create((set): any => ({
  WBI: {},
  setWBI: (WBI?: any) => {
    set({ WBI: WBI || {} })
  },
  resetWBI: () => set({ WBI: {} }),
}))



export {
  useLanguage,
  useRefreshBugList,
  useWBI,
}
